package com.taotao.common.constant;

public class SystemConstant {
	
	public static int IN_VALID = 0;

	public static int VALID = 1;
	
	public enum NodeStatus{
		CLOSED(0 , "closed"),
		OPEN(1 , "open");
		
		private int code;
		
		private String name;
		
		private NodeStatus(int code, String name) {
            this.code = code;
            this.name = name;
        }

        public Integer getCode() {
            return code;
        }

        public String getName() {
            return name;
        }
		
        public static String getNameByCode (Integer code) {
            for (NodeStatus nodeStatus : NodeStatus.values()) {
                if (nodeStatus.getCode() == (code)) {
                    return nodeStatus.getName();
                }
            }
            return null;
        }
	}
	
	public enum ParentFlag{
		NOTPARENT(0 , "open"),
		PARENT(1 , "closed");
		
		private int code;
		
		private String name;
		
		private ParentFlag(int code, String name) {
            this.code = code;
            this.name = name;
        }

        public Integer getCode() {
            return code;
        }

        public String getName() {
            return name;
        }
		
        public static String getNameByCode (Integer code) {
            for (ParentFlag parentFlag : ParentFlag.values()) {
                if (parentFlag.getCode() == (code)) {
                    return parentFlag.getName();
                }
            }
            return null;
        }
	}
	
	public enum ValidStatus{
		VALID( 1 , "1"),
		INVALID( 2 , "2");
		
		private int type;
		
		private String name;
		
		private ValidStatus(int type, String name) {
            this.type = type;
            this.name = name;
        }

        public Integer getType() {
            return type;
        }

        public String getName() {
            return name;
        }
		
        public static String getNameByCode (Integer type) {
            for (ValidStatus validStatus : ValidStatus.values()) {
                if (validStatus.getType() == (type)) {
                    return validStatus.getName();
                }
            }
            return null;
        }
	}
	
	public enum ProductStatus{
		//1-正常，2-下架，3-删除
		NORMAL( 1 , "正常"),
		UNSHELVE( 2 , "下架"),
		DELETE( 3 , "删除");
		
		private int type;
		
		private String name;
		
		private ProductStatus(int type, String name) {
            this.type = type;
            this.name = name;
        }

        public int getType() {
            return type;
        }

        public String getName() {
            return name;
        }
		
        public static String getNameByCode (int type) {
            for (ProductStatus productStatus : ProductStatus.values()) {
                if (productStatus.getType() == (type)) {
                    return productStatus.getName();
                }
            }
            return null;
        }
	}

}
